package org.jeecg.modules.login;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.login.LoginService;
import org.jeecg.common.login.parameter.DoubleFactorAuthParameter;
import org.jeecg.common.login.parameter.OriginalParameter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 登录配置
 *
 * @author tianyi.jiang
 * @version 1.2.4
 */
@Component
public class LoginConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public LoginService defaultLoginService() {
        return new DefaultLoginServiceImpl();
    }

    public static class DefaultLoginServiceImpl implements LoginService {

        private static final String ERROR_MSG = "登录配置项错误, 请检查LoginService实现！";

        @Override
        public Result<?> authByThirdAccount(String thirdId, String type) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> authByMobile(String mobile) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> auth4WechatMiniProgram(String thirdId, String type) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> register4WechatMiniProgram(String thirdId, String mobile) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> auth4DingMiniProgram(String mobile) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> getDoubleFactorParameter(OriginalParameter originalParameter) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> writeCaptcha4DoubleFactor(String key, String captcha, String signature) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> auth4DoubleFactorParameter(DoubleFactorAuthParameter doubleFactorAuthParameter) {
            return Result.error(ERROR_MSG);
        }

        @Override
        public Result<?> auth4WechatPublic(String thirdId) {
            return Result.error(ERROR_MSG);
        }
    }

}